package gui;

/**
 * @author Ramy Refky 
 * */
public class Actions {

//	  actionNothing...............action code=0;
//	  actionSelect................action code=1
//	  actionMove..................action code=2
//	  actionZoomIn................action code=3
//	  actionZoomOut...............action code=4
//	  actionAddANDGate............action code=5
//	  actionAddWire...............action code=6;
//	  actionMoveWire..............action code=7;
//	  actionAddNANDGate...........action code=8;
//	  actionAddORGate.............action code=9;
//	  actionAddNORGate............action code=10;
//	  actionAddNOTGate............action code=11;
//	  actionAddBUFFERGate.........action code=12;
//	  actionAddXORGate............action code=13;
//	  actionAddXNORGate...........action code=14;
//	  actionAddTSBUFFERGate.......action code=15;
//	  actionAddNode...............action code=16;
//	  actionDelete................action code=17;
//	  actionAddDFFGate............action code=18;
//	  actionAddTFFGate............action code=19;
//	  actionAddJKFFGate...........action code=20;
//	  actionAddSRFFGate...........action code=21;
//	  actionAddCustomGate.........action code=22;
//	  actionAddTextGate...........action code=23;
//	  actionAddModuleGate.........action code=24;
//	  actionAddSplitterGate.......action code=25;
//	  actionAddGrouperGate........action code=26;
	
	byte currentAction;
	double zoomFactor;
	boolean addedFirstWirePoint;
	ComponentPin firstWirePin;
	ComponentPin secondWirePin;
	/**
	 * Constructor initializes the current action and zoom factor.
	 * */
	public Actions(){
		zoomFactor=1.0;
		addedFirstWirePoint=false;
		currentAction=1;
	}
	/**
	 * Sets action to nothing. (actionCode=0).
	 * */
	public void setActionToNothing() {
		currentAction=0;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to select. (actionCode=1).
	 * */
	public void setActionToSelect() {
		currentAction=1;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to move. (actionCode=2).
	 * */
	public void setActionToMove() {
		currentAction=2;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to zoom-in. (actionCode=3).
	 * */
	public void setActionToZoomIn(){
		currentAction=3;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to zoom-out. (actionCode=4).
	 * */
	public void setActionToZoomOut(){
		currentAction=4;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add AND Gates. (actionCode=5).
	 * */
	public void setActionToAddANDGate(){
		currentAction=5;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add wires. (actionCode=6).
	 * */
	public void setActionToAddWire(){
		currentAction=6;
	}
	/**
	 * Sets action to fine-tune wires. (actionCode=7).
	 * */
	public void setActionToMoveWire(){
		currentAction=7;
		setAddedFirstWirePoint(false);
	}
	/**
	 * This method sets a boolean value to addedFirstWirePoint.
	 * If true-> a first wire point has been added. 
	 * */
	public void setAddedFirstWirePoint(boolean value){
		addedFirstWirePoint=value;
	}
	/**
	 * Checks if a first wire point has been added.
	 * @return boolean
	 * */
	public boolean checkIfAddedFirstWirePoint(){
		return addedFirstWirePoint;
	}
	/**
	 * Sets the first ComponentPin of a wire.
	 * */
	public void setFirstPin(ComponentPin p){
		firstWirePin=p;
	}
	/**
	 * Sets the second ComponentPin of a wire.
	 * */
	public void setSecondPin(ComponentPin p){
		secondWirePin=p;
	}
	/**
	 * Gets the first ComponentPin of a wire.
	 * @return ComponentPin
	 * */
	public ComponentPin getFirstPin(){
		return firstWirePin;
	}
	/**
	 * Gets the second ComponentPin of a wire.
	 * @return ComponentPin
	 * */
	public ComponentPin getSecondPin(){
		return secondWirePin;
	}
	/**
	 * Gets the current actionCode number.
	 * @return byte
	 * */
	public byte getCurrentAction(){
		return currentAction;
	}
	/**
	 * Gets the current zoom factor.
	 * @return double
	 * */
	public double getZoomFactor(){
		return zoomFactor;
	}
	/**
	 * Sets the current zoom factor.
	 * */
	public void setZoomFactor(double factor){
		zoomFactor=factor;
	}
	/**
	 * Sets action to add NAND Gates. (actionCode=8).
	 * */
	public void setActionToAddNANDGate(){
		currentAction=8;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add OR Gates. (actionCode=9).
	 * */
	public void setActionToAddORGate(){
		currentAction=9;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add NOR Gates. (actionCode=10).
	 * */
	public void setActionToAddNORGate(){
		currentAction=10;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add NOT Gates. (actionCode=11).
	 * */
	public void setActionToAddNOTGate(){
		currentAction=11;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add BUFFER Gates. (actionCode=12).
	 * */
	public void setActionToAddBUFFERGate(){
		currentAction=12;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add XOR Gates. (actionCode=13).
	 * */
	public void setActionToAddXORGate(){
		currentAction=13;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add XNOR Gates. (actionCode=14).
	 * */
	public void setActionToAddXNORGate(){
		currentAction=14;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add TRI-STATE BUFFER Gates. (actionCode=15).
	 * */
	public void setActionToAddTSBUFFERGate(){
		currentAction=15;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add Nodes. (actionCode=16).
	 * */
	public void setActionToAddNodeComponent(){
		currentAction=16;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to delete. (actionCode=17).
	 * */
	public void setActionToDelete(){
		currentAction=17;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add D-FLIP-FLOP Gates. (actionCode=18).
	 * */
	public void setActionToAddDFFGate(){
		currentAction=18;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add T-FLIP-FLOP Gates. (actionCode=19).
	 * */
	public void setActionToAddTFFGate(){
		currentAction=19;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add JK-FLIP-FLOP Gates. (actionCode=20).
	 * */
	public void setActionToAddJKFFGate(){
		currentAction=20;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add SR-FLIP-FLOP Gates. (actionCode=21).
	 * */
	public void setActionToAddSRFFGate(){
		currentAction=21;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add Custom Gates. (actionCode=22).
	 * */
	public void setActionToAddCustomGate(){
		currentAction=22;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add Text labels. (actionCode=23).
	 * */
	public void setActionToAddTextGate(){
		currentAction=23;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add imported modules. (actionCode=24).
	 * */
	public void setActionToAddModuleGate(){
		currentAction=24;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add SPLITTER Gates. (actionCode=25).
	 * */
	public void setActionToAddSplitterGate(){
		currentAction=25;
		setAddedFirstWirePoint(false);
	}
	/**
	 * Sets action to add GROUPER Gates. (actionCode=26).
	 * */
	public void setActionToAddGrouperGate(){
		currentAction=26;
		setAddedFirstWirePoint(false);
	}
}
